package com.jason.www.controller;

import com.jason.www.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Cai on 2018/6/15.
 */
@Controller
@RequestMapping("/user")
public class UserController {

    @RequestMapping("/text")
    public ModelAndView userTest() {
        Map map = new HashMap();
        map.put("userTest", "jasonchoi");
        System.out.println("sfasdaf");
        return new ModelAndView("userTest", map);
    }


    @RequestMapping("/jsonTest")
    @ResponseBody
    public User jsonTest(@RequestBody User user) {
        System.out.println(user.getUserName());
        return user;
    }
}
